import json
import pymysql
import requests
import json
import urllib.parse
import math

conn = pymysql.connect(
    host='localhost',  # mysql服务器地址
    port=3306,  # 端口号
    user='root',  # 用户名
    passwd='root',  # 密码
    db='journal',  # 数据库名称
    charset='utf8',  # 连接编码，根据需要填写
)
cur = conn.cursor()  # 创建并返回游标
aa = cur.execute('SELECT sno from journal;')
info = cur.fetchmany(aa)
i = 61141
for li in info[61141:]:
    sno = li[0]
    print(sno)
    sql = "SELECT znum FROM yzwx WHERE sno='" + sno + "';"
    bb = cur.execute(sql)
    info1 = cur.fetchmany(bb)
    if info1:
        yzwx_num = info1[0][0]
    else:
        yzwx_num = '0'
    sql1 = "UPDATE journal SET yzwx_num = '" + yzwx_num + "' WHERE journal.sno = '" + sno + "';"
    cur.execute(sql1)
    conn.commit()
    print("正在处理第",i,"条，还剩",80438-i,"条数据")
    i += 1
conn.close()